更新说明:对文章排版以及内容格式做了调整。
更新时间:2022-05-04
第一步:
需要两个jar包(aymsp-alipay下备份):
- mybatis-generator-core-1.4.0.jar
- mysql-connector-java-5.1.31.jar (数据库驱动)
第二步:
配置 generatorConfig.xml文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> <generatorConfiguration> <classPathEntry location="mysql-connector-java-5.1.31.jar" /> <context id="MySQL" targetRuntime="MyBatis3">
<commentGenerator> <property name="suppressDate" value="true"/> <property name="suppressAllComments" value="true"/> </commentGenerator> <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/aymspdb" userId="root" password="pass"> </jdbcConnection> <javaTypeResolver > <property name="forceBigDecimals" value="false" /> </javaTypeResolver> <javaModelGenerator targetPackage="org.ayfoundation.api.impl.app.alipay.entity.model" targetProject="output"> <property name="enableSubPackages" value="true" /> <property name="trimStrings" value="true" /> </javaModelGenerator> <sqlMapGenerator targetPackage="test.xml" targetProject="output"> <property name="enableSubPackages" value="true" /> </sqlMapGenerator> <javaClientGenerator type="XMLMAPPER" targetPackage="org.ayfoundation.api.impl.app.alipay.entity.dao" targetProject="output"> <property name="enableSubPackages" value="true" /> </javaClientGenerator> <table tableName="app_alipay_downloadbill" domainObjectName="AlipayBillInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="true" selectByExampleQueryId="true"> </table> </context> </generatorConfiguration>
|
第三步:
java -jar mybatis-generator-core-1.3.5.jar -configfile generatorConfig.xml